package com.piece.mall.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Data
@Entity
@Table(name = "sms_coupon_history")
@ApiModel(value = "优惠券领取历史记录")
public class SmsCouponHistory implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", length = 11)
    @ApiModelProperty(value = "主键")
    private Long id;

    @Column(name = "coupon_id")
    @ApiModelProperty(value = "优惠券主键")
    private Long couponId;

    @Transient
    @ApiModelProperty(value = "优惠卷名称")
    private String couponName;

    @Column(name = "member_id")
    @ApiModelProperty(value = "会员主键")
    private Long memberId;

    @Column(name = "nick_name")
    @ApiModelProperty(value = "会员名字")
    private String nickName;

    @Column(name = "get_type")
    @ApiModelProperty(value = "获取方式", notes = "0=后台赠送, 1=主动领取")
    private String getType;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @Column(name = "use_status")
    @ApiModelProperty(value = "使用状态", notes = "0=未使用, 1=已使用, 2=已过期")
    private String useStatus;

    @Column(name = "use_time")
    @ApiModelProperty(value = "使用时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date useTime;

    @Column(name = "order_id")
    @ApiModelProperty(value = "订单主键")
    private Long orderId;

    @Column(name = "order_sn")
    @ApiModelProperty(value = "订单号")
    private String orderSn;

}
